﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowAnnounce.aspx.cs" Inherits="ZX.WebApp.EHR.hrAnnounceAjax" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head" runat="server">
    <title></title>
    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/Public.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var id = getPar1("ID"); //消息ID
            //var url = "../Extend/AjaxData/jsonlist.aspx?entity=DatMessageQueue&condition=MsgID='" + id + "'";
            var url = "../Extend/AjaxData/jsonlist.aspx?entity=tmInformation&condition=ID='" + id + "'";

            $.get(url, function (d, s) {
                d = d.replace(/(\\+\")/g, '\'');
                var list = eval("(" + d + ")");
                if (list.total > 0) {
                    for (var o in list.rows) {
                        //                        var t = list.rows[o].MsgContent;
                        //                        var s = list.rows[o].Title;
                        var t = list.rows[o].Contents;
                        var s = list.rows[o].Title;
                        if (typeof (t) != "undefined") {
                            var token = t.split("br");
                            var htmlStr = "<h2 style='font-style: normal; font-weight: lighter'>";
                            for (var i = 0; i < token.length; i++) {
                                var str = token[i];
                                var token2 = str.split("span1");
                                for (var j = 0; j < token2.length; j++) {
                                    str = str.replace("span1", "<span style='color: #ff0000'>");
                                }
                                var token3 = str.split("span2");
                                for (var j = 0; j < token3.length; j++) {
                                    str = str.replace("span2", "</span>");
                                }
                                if (i != token.length - 1) {
                                    htmlStr += str + "</h2><h2 style='font-style: normal; font-weight: lighter'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                }
                                else {
                                    htmlStr += str + "</h2>";
                                }
                            }
                            $("#div").append(htmlStr);
                            $("#title").html(s);
                        }
                    }
                }
            });
            //如果消息不是针对全体，则将消息置为已读
            //            var url = "../Extend/AjaxData/jsonlist.aspx?entity=DatMessageReceiver&condition=MsgID='" + id + "'";
            //            $.get(url, function (d, s) {
            //                var list = eval("(" + d + ")");
            //                if (list.total > 0) {
            //                    for (var o in list.rows) {
            //                        var t = list.rows[o].ReceiverID;
            //                        if (typeof (t) != "undefined") {
            //                            if (t != "00000000-0000-0000-0000-000000000000" && list.rows[o].ReceiverType != "v")//非公共消息
            //                            {
            //                                SetPushState(id)
            //                            }
            //                        }
            //                    }
            //                }
            //            });
        });

        function SetPushState(msgId) { //设置消息的pushstate为已读
            var url = "../../Extend/AjaxData/DataProcessin.aspx?action=save" + "&r=" + Math.random() + "&entity=hrAnnounce&ids=" + msgId;
            YAHOO.util.Connect.asyncRequest('POST', url, {
                success: function (res) {
                    if (res.responseText != "") {
                        alert("错误信息：" + res.responseText);
                    }
                },
                failure: function (error) {
                    alert("数据错误：" + error.statusText);
                }
            }, null);
        }

        function GoPositive() {
            parent.parent.addTabs('提交申请', 'crm/BasePages/StartWorkflow.aspx?title=提交申请&WorkflowId=51460fe2-a3b2-48d3-9b59-3d01064a4204&WorktaskId=48ac968d-2f8e-48ad-a5f1-ac682b9bb85e');
            //parent.parent.addTabs("转正申请", "http://" + this.location.host + "/crm/BasePages/Affix.aspx?WorkflowId=51460fe2-a3b2-48d3-9b59-3d01064a4204&WorktaskId=48ac968d-2f8e-48ad-a5f1-ac682b9bb85e&WorkFlowInstanceId=&Status=0");
        }
    </script>
</head>
<body>
 <form id="form1" runat="server">
    <br />
    <div align="center"><h1 id="title"></h1></div>
    <div id="div">
        
    </div>
    </form>
</body>
</html>